<%@ taglib prefix="form" uri="http://www.springframework.org/tags/form" %>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%--
  Created by IntelliJ IDEA.
  User: qiliping
  Date: 16/4/9
  Time: 下午3:10
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<c:set var="ctx" value="${pageContext.request.contextPath}"/>
<html>
<head>
    <title>分配理财顾问</title>
    <script>
        $(function(){
           $("#agentId").change(function(){
              var sval = $(this).val();

               if(sval!=null&& sval>0){
                   $.ajax({
                      url:"${ctx}/user/get_saleman_by_agent",
                       type:"post",
                       dataType:'json',
                       data:{id:sval},
                       success:function(res){
//                           alert(res[0].agentId);
                           $("#saleManId").html('<option value="">--请选择业务员--</option>');
                           $.each(res, function (index, data) {
                               $("#saleManId").append('<option value="'+data.agentId+'">'+data.agentName+'</option>');

                           })
                       }
                   });
               }
           });
        });
    </script>
</head>
<body>
<div class="row">
    <div class="col-md-12">
        <!-- BEGIN PAGE TITLE & BREADCRUMB-->
        <h3 class="page-title">
            客户投资管理
            <small>投资者管理</small>
        </h3>
        <ul class="page-breadcrumb breadcrumb">
            <li>
                <i class="fa fa-home"></i>
                <a href="${ctx}/main">
                    首页
                </a>
                <i class="fa fa-angle-right"></i>
            </li>
            <li>
                <a href="${ctx}/user">
                    投资者管理
                </a>
                <i class="fa fa-angle-right"></i>
            </li>
            <li>
                <a href="#">
                    分配理财顾问
                </a>
            </li>
        </ul>
        <!-- END PAGE TITLE & BREADCRUMB-->
    </div>
</div>
<!-- END PAGE HEADER-->
<!------内容区---->
<div class="main">

    <div class="row">
        <div class="col-md-12">
            <form:form method="post" modelAttribute="SetFollowSaleManModel"
                       class="form-horizontal">
                <form:hidden path="userId"></form:hidden>
                <div class="form-group">
                    <label class="control-label col-md-3">选择理财顾问：</label>
                    <div class="col-md-2">
                        <form:select path="agentId" class="form-control" >

                            <option value="">--请选择公司--</option>
                            <form:options items="${agentList}" itemValue="agentId" itemLabel="agentName" />

                            <%--<c:forEach var="item" items="${agentList}">
                                <option value="${item.agentId}">${item.agentName}</option>
                            </c:forEach>--%>

                        </form:select>
                        <form:select path="saleManId" class="form-control" >
                        <%--<select name="saleman" class="form-control" id="saleman">--%>
                            <option value="">--请选择理财顾问--</option>
                            <form:options items="${saleManList}" itemValue="agentId" itemLabel="agentName" />
                        <%--</select>--%>
                        </form:select>
                    </div>

                </div>

                <div class="form-group">
                    <div class="col-md-9 col-md-offset-3">
                        <button type="submit" class="btn blue">分配</button>
                        <span class="field-validation-error">${error}</span>
                    </div>
                </div>
            </form:form>
        </div>
    </div>

</div>
</body>
</html>
